//
//  LJPermissionUtil.h
//  LajinLive
//
//  Created by 刘洋 on 16/8/19.
//  Copyright © 2016年 lajin. All rights reserved.
//

#import <Foundation/Foundation.h>

/** 相册权限状态 */
typedef NS_ENUM(NSInteger, IGPhotoAuthorizationStatus) {
    IGPhotoAuthorizationStatusNotDetermined = 0,
    IGPhotoAuthorizationStatusRestricted,
    IGPhotoAuthorizationStatusDenied,
    IGPhotoAuthorizationStatusAuthorized
};

/** 通讯录权限状态 */
typedef NS_ENUM(NSInteger, IGAddressBookAuthorizationStatus) {
    IGAddressBookAuthorizationStatusNotDetermined = 0,
    IGAddressBookAuthorizationStatusRestricted,
    IGAddressBookAuthorizationStatusDenied,
    IGAddressBookAuthorizationStatusAuthorized
};

/** 提示框的显示的文字类型 */
typedef NS_ENUM(NSInteger, IGPermissionsAlertType) {
    IGPermissionsAlertTypePhoto = 0,  //请在“设置-隐私-照片”中，允许画屏访问你的手机相册
    IGPermissionsAlertTypeVoice,      //请在“设置-隐私-麦克风”中，允许画屏访问你的麦克风
    IGPermissionsAlertTypeCamera,     //请在“设置-隐私-相机”中，允许画屏访问你的相机
    IGPermissionsAlertTypeAddressBook,//请在“设置-隐私-通讯录”中，允许画屏访问你的通讯录
    IGPermissionsAlertTypeNetWorkSet  //去设置“打开无线局域网与蜂窝移动数据”
};

@interface IGPermissionUtil : NSObject

/**
 *  @author yangL, 16-08-19 11:08:04
 *
 *  判断是否有获取相册的使用权限
 *
 *  @return LJPhotoAuthorizationStatus
 *
 *  @since 1.2
 */
+ (IGPhotoAuthorizationStatus)photoAuthorizationStatus;

/**
 *  @author yangL, 16-08-19 11:08:40
 *
 *  请求相册的使用权限
 *
 *  @param successBlock 请求相册权限成功执行的block
 *  @param failureBlock 请求相册权限失败执行的block
 *
 *  @since 1.2
 */
+ (void)requestPhotoAuthorization:(nullable void(^)())successBlock failureBlock:(nullable void(^)())failureBlock;

/**
 *  @author yangL, 16-08-19 11:08:34
 *
 *  根据系统的版本号显示个用户的提示框
 *
 *  @param permissionsAlertType LJPermissionsAlertType 控制提示的文字
 *
 *  @since 1.2
 */
+ (void)ig_showAlertViewWithPermissionsAlertType:(IGPermissionsAlertType)permissionsAlertType block:(nullable void(^)())block;

/**
 *  @author yangL, 16-08-23 11:08:35
 *
 *  集成首先校验是否有相机和相册是使用权限的actionSheet items 拍照、从相册选取
 *
 *  @param cameraBlock   点击拍照执行的block
 *  @param photoBlock    点击从相册获取执行的block
 *
 *  @since 1.2
 */
+ (void)ig_showActionSheetWithCameraBlock:(nullable void(^)())cameraBlock photoBlock:(nullable void(^)())photoBlock;

/**
 *  @author yangL, 16-08-19 15:08:06
 *
 *  相机、麦克风、相册的权限是否完全打开
 *
 *  @return BOOL YES：全部开启  NO：没有全部开启
 *
 *  @since 1.2
 */
+ (BOOL)isAllPermissionsOpen;

/**
 *  @author yangL, 16-08-19 11:08:04
 *
 *  判断是否有获取通讯录的使用权限
 *
 *  @return IGAddressBookAuthorizationStatus
 *
 *  @since 1.2
 */
+ (IGAddressBookAuthorizationStatus)addressAuthorizationStatus;

/**
 *  @author yangL, 16-08-19 11:08:40
 *
 *  请求通讯录的使用权限
 *
 *  @param successBlock 请求通讯录权限成功执行的block
 *  @param failureBlock 请求通讯录权限失败执行的block
 *
 *  @since 1.2
 */
+ (void)requestAddressBookAuthorization:(nullable void(^)())successBlock failureBlock:(nullable void(^)())failureBlock;


@end
